<div ng-controller="contractListCtrl">
    <div class="table-header mt5 clearfix ng-scope">
        <span class="fl lh30 f14">合同管理</span>
    </div>

    <my-nav data-nav-items="filterDataStatus" onchanged="changeStatus" data-title="合同状态:"></my-nav>
    <my-nav data-nav-items="filterDataNature" onchanged="changeNature" data-title="合同性质:"
            data-text-field="property_name"></my-nav>
    <my-nav data-nav-items="filterDataCities" onchanged="changeCity" data-title="城市区域:" data-text-field="areaName" need-more="true"></my-nav>

    <div class="table-header mt20 clearfix ng-scope">
        <span class="fl lh30 f14">合同列表</span>

        <div class="fr btn-group">
            <input class="input-text fl ng-pristine ng-untouched ng-valid" style="width: 470px;" type="text"
                   placeholder="公司/公司简称/合同编号" ng-model="query.keyword" ng-enter="query.execute()"/>
            <a class="btn" href="javascript: void(0)" ng-click="query.execute()">查询</a>
            <a class="btn" href="/contract/edit.shtml#base" target="_blank">新建合同</a>
            <!--<a href="javascript: void(0)" class="btn btn-yellow"-->
               <!--ui-dialog="导入纸质文档"-->
               <!--ui-dialog-url="contract/dialog/import.html"-->
               <!--ui-dialog-data="{}"-->
               <!--ui-dialog-ok="brokerage.importData($data)">导入纸质文档</a>-->
            <a class="btn btn-yellow" href="javascript: void(0)" ng-click="export()">导出合同</a>            
        </div>
    </div>

    <div id="grid" class="table-wrap mt10">
        <table width="100%" class="valign-t">
            <thead>
            <tr>
                <th width="35">序号</th>
                <th width="150">客户信息</th>
                <th width="190">合同信息</th>
                <th>合同签署公司</th>
                <th width="140">签约信息</th>
                <th width="120">金额信息</th>
                <th width="65">合同状态</th>
                <th width="90">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in contracts">
                <td height="40"><p ng-bind="$index + 1 + startPageIndex"></p></td>
                <td class="lh14">
                    <p ng-bind="record.customer_full_name"></p>

                    <p class="c-gray">客户简称:{{record.customer_name}}</p>
                </td>
                <td>
                    <p ng-bind="record.contract_code"></p>

                    <p class="c-gray">合同性质:{{record.property_name}}</p>

                    <p class="c-gray">合同类别:{{record.category_name}}</p>

                    <p ng-if="record.beginOn" class="c-gray">
                        租期:{{record.beginOn|strdate:'yyyy-MM-dd'}}至{{record.endOn|strdate:'yyyy-MM-dd'}}
                    </p>
                </td>
                <td>
                    <p ng-bind="record.company_name"></p>

                    <p class="c-gray">所属区域:{{record.area_name}}</p>
                </td>
                <td>
                    <p>签约人:{{record.user_name}}</p>

                    <p class="c-gray">签约日期:{{record.sign_date | strdate: 'yyyy-MM-dd'}}</p>

                    <p class="c-gray">录入日期:{{record.input_date | strdate: 'yyyy-MM-dd'}}</p>
                </td>
                <td>
                    <p>签约金额:{{record.sign_amount | number}}</p>

                    <p class="c-gray">租用金额:{{record.rent_amount | number}}</p>

                    <p class="c-gray">交付金额:{{record.delivery_amount | number}}</p>
                </td>
                <td>
                    <p ng-if="record.contract_status == 0 && record.is_cancelled == 0">草稿</p>

                    <p ng-if="record.contract_status == 1 && record.is_cancelled == 0">提交复核</p>

                    <p ng-if="record.contract_status == 2 && record.is_cancelled == 0">已审核</p>

                    <p ng-if="record.is_cancelled == 1">作废</p>
                </td>
                <td>
                    <div row-toolbar min-buttons-show="8">
                        <a ng-click="submitVerify(record)" class="clearfix" href="javascript:void(0)"
                           ng-if="record.contract_status==0 && record.is_cancelled == 0"
                           title="提交复核">提交复核</a>
                        <a ng-click="cancelVerify(record)" class="clearfix" href="javascript:void(0)"
                           ng-if="record.contract_status==1 && record.is_cancelled == 0"
                           title="撤销复核">撤销复核</a>
                        <a ng-click="confirmVerify(record)" class="clearfix" href="javascript:void(0)"
                           ng-if="record.contract_status==1 && record.is_cancelled == 0"
                           title="复核">复核</a>
                        <a ng-href="/contract/edit.shtml#/base?id={{record.contract_id}}" target="_blank" class="clearfix" title="编辑合同信息"
                           ng-if="record.contract_status == 0 && record.is_cancelled == 0"
                           title="编辑">编辑</a>
                        <a ng-href="/contract/edit.shtml#/base?id={{record.contract_id}}" target="_blank" class="clearfix" title="编辑发票、回款信息"
                           ng-if="record.contract_status!=0 || record.is_cancelled == 1"
                                >编辑</a>
                        <a ng-click="cancelContract(record)" class="clearfix" href="javascript:void(0)"
                           ng-if="record.is_cancelled == 0"
                           title="作废">作废</a>
                        <a ng-href="/contract/edit.shtml#/base?pid={{record.contract_id}}" target="_blank" class="clearfix"
                           ng-if="record.is_cancelled == 0"
                           title="新建附属合同">新建附属合同</a>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" style="display:none"><span>暂无数据</span></div>
    </div>
    <div id="pagination" class="pagination"></div>
</div>
